package com.fbli.test.mapper;

import com.fbli.test.entity.Project;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
@Mapper
public interface ProjectMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Project record);
    int insertSelective(Project record);
    Project selectByPrimaryKey(Long id);

    List<Project> selectAll();

    int updateByPrimaryKey(Project record);
    //userId || id 查询
    List<Project> getProjects(@Param("userId") long userId,@Param("id") long projectId);

    Project findFirstByIdAndUserIdAndDeletedFalse(@Param("userId") long userId,@Param("id") long projectId);

    int delete(@Param("userId") long userId,@Param("projectIdList") List<Long> projectIdList);

    /**
     * 根据项目id或项目名称条件查询
     * @param condition
     * @return
     */
    List<Project> selectByIdOrByName(@Param("condition") String condition);
}